home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr05
/
mswlogo3.zip
/
MSWLOGO.ZIP
/
EXAMPLES.ZIP
/
VISUAL.WIN
< prev
Wrap
Text File
|
1993-04-11
|
3KB
|
145 lines
;
; This Example is actually the core of (seed to) a much larger application.
; It is a visual editor for editing Logo Windows/Dialog boxes with the mouse.
; It's actaully a good seed to a Paint/Draw/Cad like application too.
; It was also a great test for flushing bugs out of MswLogo itself.
;
; Currently all that it does is:
;
; Create a "Button" (Draw it and put it in a DataBase),
; Allow you to select the "Button" with the mouse (Mouse Button down in Box).
; Allow you to drag the Box to another location and update database.
; Allow you to deselect the "Button" (Mouse Button up).
; Allow you to Erase the "Button" and remove it from the Database.
;
; Eventually it should be capable of reading in your Logo routine that
; sizes and places your buttons, modify it "Visually", and then
; write it back out. In otherwords it should be able to edit a routine
; like "dowindows" below "Visually".
;
to deletething
mouseon [lbtndowndel] [] [] [] []
make "mousedn "false
make "boxisselected "false
end
to dowindows
windowcreate "root "dlg [Visual Logo] 0 0 100 100
buttoncreate "dlg "end "End 0 0 25 25 [visualend]
buttoncreate "dlg "new [New Button] 0 25 50 25 [newbutton]
buttoncreate "dlg "del [Delete] 0 50 50 25 [deletething]
end
to drawbox :box
make "x first :box
make "y first butfirst :box
make "w first butfirst butfirst :box
make "h last :box
setxy :x :y
penreverse
setxy :x+:w :y
setxy :x+:w :y+:h
setxy :x :y+:h
setxy :x :y
pu
end
to inanybox :pos :boxs
if emptyp :boxs [output "false]
if inbox :pos last first :boxs [make "select first :boxs output "true]
output inanybox :pos butfirst :boxs
end
to inbox :pos :box
make "xp first :pos
make "yp last :pos
make "xb first :box
make "yb first butfirst :box
make "wb first butfirst butfirst :box
make "hb last :box
if :xp > :xb+:wb [output "false]
if :xp < :xb [output "false]
if :yp > :yb+:hb [output "false]
if :yp < :yb [output "false]
output "true
end
to lbtndown
make "posd mousepos
if inanybox :posd :master [selectbox :select make "boxisselected "true make "backupselect :select]
make "mousedn "true
end
to lbtndowndel
make "posd mousepos
if inanybox :posd :master~
[~
setpensize [2 2]~
drawbox last :select~
make "master remove :select :master~
]
end
to lbtnup
if :boxisselected~
[~
make "boxisselected "false~
unselectbox :select~
make "master remove :backupselect :master~
make "master lput :select :master~
]
make "mousedn "false
end
to mmove
make "posm mousepos
if :boxisselected~
[~
setpensize [4 4]~
drawbox last :select~
make "select lput fput first :posm fput last :posm butfirst butfirst last :select butlast :select~
drawbox last :select~
make "posd :posm~
]
end
to newbutton
mouseon [lbtndown] [lbtnup] [] [] [mmove]
make "name readlist
make "mousedn "false
make "boxisselected "false
make "master lput ["button :name [0 0 25 25]] :master
setpensize [2 2]
drawbox last last :master
end
to selectbox :box
setpensize [2 2]
drawbox last :box
setpensize [4 4]
drawbox last :box
end
to unselectbox :box
setpensize [4 4]
drawbox last :box
setpensize [2 2]
drawbox last :box
end
to visual
ht
pu
setpensize [2 2]
make "master []
dowindows
end
to visualend
windowdelete "dlg
mouseoff
st
cs
end